package com.third.customer.site.controller.resp;

import com.third.customer.model.tables.Company;
import com.third.customer.service.utils.TimeUtils;
import lombok.Data;

/**
 * Created by hehuaichun on 2020/6/27.
 */
@Data
public class CompanyResp {
    private String id;

    private String name;

    private String description;

    private String createdAt;

    public static CompanyResp convert(Company company) {
        CompanyResp resp = new CompanyResp();
        resp.setId(String.valueOf(company.getId()));
        resp.setName(company.getName());
        resp.setDescription(company.getDescription());
        if (company.getCreatedAt() != null) {
            resp.setCreatedAt(TimeUtils.dateToString(company.getCreatedAt()));
        }
        return resp;
    }
}
